UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W8Mi1fLtuiw06d6KMwsrRk233dMBzv5Kz9zT2bUOXHs=' 
WHERE 
  key_id = '9b519be0f3704fe6a7a125551ae5555e57d0f6f78bdc85063e377206f8ff3dd2' 
  AND (
    token = 'W8Mi1fLtuiw06d6KMwsrRk233dMBzv5Kz9zT2bUOXHs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040