UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QQo6841QdDKhIpFy0a/F8TdVbjt305fCRYt4RyetkKw=' 
WHERE 
  key_id = '9abb2f8bdaa4e6b9b6fec91064590aa5c140ee2904082423b8909ee014f97ba3' 
  AND (
    token = 'QQo6841QdDKhIpFy0a/F8TdVbjt305fCRYt4RyetkKw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044