UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7QGzT1QGk/zKcjlWORVvufmpiw8czd8TOzLsWEL5J6k=' 
WHERE 
  key_id = 'bc4e6b3ad1688f4dd4306fbe4e438eeeaabb1d0344a80a7f2dd84075cf11e24a' 
  AND (
    token = '7QGzT1QGk/zKcjlWORVvufmpiw8czd8TOzLsWEL5J6k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032