UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sx0812su+gSefkZWWyI9W/V1fi/V02Bo6xpnQDPw9Q8=' 
WHERE 
  key_id = '5db2afdcfd1bb1b9efb8366605b04994e567d8265fd5142e8fde467759982d8a' 
  AND (
    token = 'sx0812su+gSefkZWWyI9W/V1fi/V02Bo6xpnQDPw9Q8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045