UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0u2lC+muan9AiVAYvJWvb/9YUW0K7dTSrPdJRYzkUME=' 
WHERE 
  key_id = '0de3168509c71805a8b7c860a4278eda75dc91aaed33152ffcdfbe9452cdb873' 
  AND (
    token = '0u2lC+muan9AiVAYvJWvb/9YUW0K7dTSrPdJRYzkUME=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031