UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'inmzabFwd8LKqJRtmx9r1i6drTbpUAdwIadIrFS1rPc=' 
WHERE 
  key_id = '5e665ca8ffe04dd6be01c0502d78e431018da4fff4dee4b6a1bf992cf4bb1bf6' 
  AND (
    token = 'inmzabFwd8LKqJRtmx9r1i6drTbpUAdwIadIrFS1rPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038