UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wRYdkhWZ/dVGrpG/2j3a50PSeEuBxiT0iHOZM5+gB8s=' 
WHERE 
  key_id = 'd56e21c77b63ab86d548cc1636d32004065914dceb71c3ef2273fe50c471f08d' 
  AND (
    token = 'wRYdkhWZ/dVGrpG/2j3a50PSeEuBxiT0iHOZM5+gB8s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025