UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kgWuqQwRrzwYA4QhiUDD4EVzaWK5++qrp1lCd5Nyq74=' 
WHERE 
  key_id = '171f3f2fbe516c88b38b9d636b498df18d2aad4637a008d00841bdd5a4aafa9f' 
  AND (
    token = 'kgWuqQwRrzwYA4QhiUDD4EVzaWK5++qrp1lCd5Nyq74=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040