UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5ZMELWwKaYYPIeuCmXDq6RnP36qEGhzfMP3eFcAjn3Y=' 
WHERE 
  key_id = 'd5828deb9e603f58ec66ce0ea715e9966bf05bc9068e928d06ca4abd030ddc5e' 
  AND (
    token = '5ZMELWwKaYYPIeuCmXDq6RnP36qEGhzfMP3eFcAjn3Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032