UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pMPzYuwlLvA+ZRwOIDu8aHcGPb2wlp35uUXNVRhNv2M=' 
WHERE 
  key_id = '46dfb6f2e673349dfa7f440cb3f150b8594e899e06ce67fc7f37d82989b02dd7' 
  AND (
    token = 'pMPzYuwlLvA+ZRwOIDu8aHcGPb2wlp35uUXNVRhNv2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033