UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DGUb5z9UVwK2MEBRxS4vnvu2u9u0h88A3+2MwYhgg1U=' 
WHERE 
  key_id = '413f1f09dfa2c332dfdd4533df99e322da361e642a875e106292cc02587e5c87' 
  AND (
    token = 'DGUb5z9UVwK2MEBRxS4vnvu2u9u0h88A3+2MwYhgg1U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030