UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rqX+28nJ3b2kS3qOhnBiR2IN8cxxSCTzX3f04jxxU2Q=' 
WHERE 
  key_id = 'e9e6d3e29b92975b435bbc53e6788fa9f81b62c6d353e3fd5e79afaf12a93449' 
  AND (
    token = 'rqX+28nJ3b2kS3qOhnBiR2IN8cxxSCTzX3f04jxxU2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052