UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't6v8asTd51r965Q12AfQDHg8kqd+kaOLhglpcbw8dVQ=' 
WHERE 
  key_id = '24fd96e11f0167a81704feb2c985fe1e7f95a603647d0da9582f72664168a71e' 
  AND (
    token = 't6v8asTd51r965Q12AfQDHg8kqd+kaOLhglpcbw8dVQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022