UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TQSAZtUc1/vOskfUXSiQJ7kEBfiin8tOE65XKPPYRZU=' 
WHERE 
  key_id = '54ae46b451b1cd3cfcd9791ee4953dbdf3de1f05d55a4a1207036ab56580ecac' 
  AND (
    token = 'TQSAZtUc1/vOskfUXSiQJ7kEBfiin8tOE65XKPPYRZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038