UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uxlT7k42L23cgmfJXnZWZF9vwSRRYq3exMy+M5NYjFc=' 
WHERE 
  key_id = '1ae790ad6a8793372005b34b3d24a6d4442e71f03848f420a8d6ee97b56f41a0' 
  AND (
    token = 'uxlT7k42L23cgmfJXnZWZF9vwSRRYq3exMy+M5NYjFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051