UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qpSIoEiS8YaktaM3DklNx+qVpOah5CEJNj2fxYdqumk=' 
WHERE 
  key_id = '796f9aa8f6160e42afe567e82e3c2fa5c364bff3b10c43354b58ac6cf7eb542f' 
  AND (
    token = 'qpSIoEiS8YaktaM3DklNx+qVpOah5CEJNj2fxYdqumk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038