UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V3vQBdG8wBmYwszIX1FEJ/GJJI2XT/H6sWitDJ35+pk=' 
WHERE 
  key_id = 'a4e22a1680368c345506589b97bb0855c7f3c87084568e5276fb96f4109ba5ab' 
  AND (
    token = 'V3vQBdG8wBmYwszIX1FEJ/GJJI2XT/H6sWitDJ35+pk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043