UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JivF5qfaW7q2oxeT5Ymi1ttYsvOchBvZIvzwpK56jEI=' 
WHERE 
  key_id = 'bba9af13aff1d29ac794d757508b1c4de5019480e66293b5da4d52a527fb6ddd' 
  AND (
    token = 'JivF5qfaW7q2oxeT5Ymi1ttYsvOchBvZIvzwpK56jEI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030