UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jpYzC+v5zJ0MOnosmfeWmEHWEMMwpe6QrOS9OQ7fMF4=' 
WHERE 
  key_id = 'b570e446172e7be43dc4bd82097f8d756fb20e95e5e5e86e25cfdab919eceaff' 
  AND (
    token = 'jpYzC+v5zJ0MOnosmfeWmEHWEMMwpe6QrOS9OQ7fMF4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023