UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ii/DmZONVo+OJyQLrT75A0h/sI2BKMmCOl95muNi1Pg=' 
WHERE 
  key_id = 'edb36366993383ec8b7a1eedaacc214cd9080d47b47c80079bbc2522afeb2f42' 
  AND (
    token = 'Ii/DmZONVo+OJyQLrT75A0h/sI2BKMmCOl95muNi1Pg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025