UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DS57Vpa8PRMJvTsFH+Cs7H7KwXHbBg19e0z8vCGtq4Y=' 
WHERE 
  key_id = '4cda4460e3db689019807e3d0574649d5903a6654a27294769809071fd5af3de' 
  AND (
    token = 'DS57Vpa8PRMJvTsFH+Cs7H7KwXHbBg19e0z8vCGtq4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035