UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HzV33VUP4YtfUT255lc09On1eu0dYyR+pF4lkqsAnFY=' 
WHERE 
  key_id = 'c59ca37c18a443a24cd9142fca13d1038861175f6bb27118c6ff2e8257d69d99' 
  AND (
    token = 'HzV33VUP4YtfUT255lc09On1eu0dYyR+pF4lkqsAnFY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031