UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dCaLDt2HpVlu6XE5VfeXXfhpk6iNJ9Fh8QaE7a1kGuo=' 
WHERE 
  key_id = 'd1d49870fd2075cc063dcbbf2a27311c6a71b95c4c586ab93ec0bb5020631c89' 
  AND (
    token = 'dCaLDt2HpVlu6XE5VfeXXfhpk6iNJ9Fh8QaE7a1kGuo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053