UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'giWdwwwueFrIpfK/g5k7YhiRLJ+NueNUZm6QpXKm5TQ=' 
WHERE 
  key_id = '0800eea485728144eda395367970f685200ec1aa8108583d30a1c2d527883e18' 
  AND (
    token = 'giWdwwwueFrIpfK/g5k7YhiRLJ+NueNUZm6QpXKm5TQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029