UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rYGT7xJOYViZs5BBZd0jiw42Uh1Y1dMLx+33Gjkczh4=' 
WHERE 
  key_id = '6a8be44f61a852217ae93729402fb632423c7cfc59be1000b27707296e635455' 
  AND (
    token = 'rYGT7xJOYViZs5BBZd0jiw42Uh1Y1dMLx+33Gjkczh4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051