UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ek/JHlYgxWnnwM1n017MERnPq4TuAjCT6XcBjq9/5CE=' 
WHERE 
  key_id = '8668b07aa4f3dca9b3fde4ecffefcb9942493df3bd61f8c386d5e7ec9c815873' 
  AND (
    token = 'Ek/JHlYgxWnnwM1n017MERnPq4TuAjCT6XcBjq9/5CE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037