UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dHPQpSRjWM9/yPQ6KOXGYSPOH/0YMNGt+UkNi9Lz4CI=' 
WHERE 
  key_id = '238d543438d45cb344b16f0f18feb03837b2dcffb0b9a8be545acd81912aad39' 
  AND (
    token = 'dHPQpSRjWM9/yPQ6KOXGYSPOH/0YMNGt+UkNi9Lz4CI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030