UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N9iZQeuTJ2CaN6vP8KmUP1b2eUDvSR5v6YGMdI87YBQ=' 
WHERE 
  key_id = '3241fe5b513e10e45e733a1131b9a96f2c93089ca132a2b1645b19bb6f61779c' 
  AND (
    token = 'N9iZQeuTJ2CaN6vP8KmUP1b2eUDvSR5v6YGMdI87YBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031