UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ks9ZoS/+G+6DyFG78DAcoA0+lnOnEt7nD8a61qnMgo4=' 
WHERE 
  key_id = '5f27a308722d9f9e7834757da098a53ba166be14770c227d412dc817e785161b' 
  AND (
    token = 'ks9ZoS/+G+6DyFG78DAcoA0+lnOnEt7nD8a61qnMgo4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020